ImageViews in a ListView not aligned vertically [Mono for Android]
Posted
by
shalmon
on Stack Overflow
See other posts from Stack Overflow
or by shalmon
Published on 2011-11-29T22:17:28Z
Indexed on
2011/11/30
1:50 UTC
Read the original article
Hit count: 432
I'm very new to developing apps to android, so bear with me.
Having said that, I'm trying to make a list with a image to the left and a title and description to the right of the image.
The image is downloaded from the web in the background and then set in the UI as they complete. This all works. However, the images are not aligned properly and I simply cannot understand why. I'm thinking it has something to do with the layout defined in the xml file? I tried using android:layout_alignParentLeft="true"
and android:layout_gravity="left"
but that got me nowhere.
Then I didn't know how to proceed, even after googling every way I could think of. I'm sorry if this is very basic, but I would really appreciate some help here.
Here's a pic of the situation:
And here's my layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/widget28"
android:layout_width="fill_parent"
android:layout_height="80px"
>
<ImageView
android:id="@+id/imageItem"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_alignParentLeft="true"
>
</ImageView>
<LinearLayout
android:id="@+id/linearText"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:orientation="vertical"
android:layout_marginLeft="10px"
android:layout_marginTop="10px"
>
<TextView
android:id="@+id/textTop"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
>
</TextView>
<TextView
android:id="@+id/textBottom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
>
</TextView>
</LinearLayout>
</LinearLayout>
I appreciate any help you can offer.
© Stack Overflow or respective owner